package commons.base.serialization.xml;

import java.util.Date;

import javax.xml.bind.annotation.adapters.XmlAdapter;

/**
 * XML日期适配器
 * @author <a href="mailto:cihang.yuan@happyelements.com">cihang.yuan</a>
 * @version 1.0 2014年4月14日
 * @since 1.0
 */
public class DateAdapter extends XmlAdapter<Long, Date> {

	@Override
	public Date unmarshal(Long v) throws Exception {
		return new Date(v);
	}

	@Override
	public Long marshal(Date v) throws Exception {
		return v.getTime();
	}

}
